import pandas as pd
df = pd.read_excel('stock.xlsx', dtype={'code':'str'})
year = df.timeToMarket.astype('str').str[:4]  # 转换为字符串，提取前4位的年份
yearnum = df.groupby(year).name.count()
print(df.pe.mean())
print(df[df.pe > df.pe.mean()].name.count())